<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <link rel="stylesheet" href="../css/Public Section.css">
    <link rel="stylesheet" href="../js/Public Section.js">
    <link rel="stylesheet" href="../img/Public Section img">
</head>
<body>
    <div class="all">
        <div class="left">
            <form action="?action=login" class="login_form" method="post">
                <div class="top">
                    <div class="wenb"><b>欢迎登录</b></div>
                </div>
                <div class="banner">
                    <div class="log-all">
                            <input class="log" type="text" name="email" placeholder="请输入手机号/邮箱">
                            <input class="pass" type="password" placeholder="请输入密码"  name="password">
                    </div>
                    <div class="foget_word">
                        <a href="#">忘记密码？</a>
                    </div>
                    
                        <input type="submit" class="login_bottom" value="登录">

                        <div class="regi"><p>没有账号？<a href="#">点击注册</a></div>

                    <div class="Login_method">
                        <div class="method">
                            <a href="#"><img src="../image/wx.png" alt=""></a>
                            <a href="#"><img src="../image/qq.png" alt=""></a>
                            <a href="#"><img src="../image/更多.png" alt=""></a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div class="right">
            <img src="../image/右边.jpg" alt="">
        </div>  
        
    </div>
</body>
</html>

<script>
    window.onload = function () {
    var Login_form = document.getElementsByClassName("login_form")[0];
    var Email = document.getElementsByName("email")[0];
    var Password = document.getElementsByName("password")[0];

    var email_zz = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/;
    var password_zz = /^[A-Za-z0-9]{6,16}$/;

    Login_form.onsubmit = function () {
        if(Email.value == ""){
            alert("邮箱不得为空");
            return false;
        }else{
            if(!email_zz.test(Email.value)){
                alert("邮箱格式错误");
                return false;
            }
        }

        if(Password.value == ""){
            alert("密码不得为空");
            return  false
        }else{
            if(!password_zz.test(Password.value)){
                alert("密码格式错误，必须为6,16位");
                return false;
            }
        }

    }
}
    </script> 